<?php

namespace Biz\model\brandData;

use Biz\pockets\modelTrait\BizModelTrait;
use Doraemon\pockets\datebase\BaseDbModel;

class ContentCtr extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_brand_data';

    const _CONFIG_SELECT_ = 'brand_data';

    const _DATABASE_ = 'brand_data';

    const _TABLE_NAME = 'content_ctr';

    const CTR_STATUS_NORMAL = 0;
    const CTR_STATUS_DELETE = 9;

    use BizModelTrait;


    public static function getContentList($objIds)
    {
        return self::dataSelect(['obj_id' => $objIds, 'ctr_status' => self::CTR_STATUS_NORMAL]);
    }

    public static function addData($data)
    {
        $info = self::dataSelectInfo(['obj_id' => $data['obj_id']]);
        if ($info) {
            self::dataUpdate($data, ['obj_id' => $info['obj_id']]);
        } else {
            self::dataInsert($data);
        }
    }
}